package com.ajk.server.bkcontroller;

import java.security.Principal;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.ajk.server.controller.access.ArgIndexForPrintLog;
import com.ajk.server.model.FriendPatientEventDay;
import com.ajk.server.model.query.FriendTreatmentQuery;
import com.ajk.server.model.response.FriendTreatmentRes;
import com.ajk.server.model.response.ResultList;
import com.ajk.server.service.FriendPatientEventDayService;
import com.ajk.server.service.FriendPatientEventService;
import com.ajk.server.service.FriendTreatmentService;

@RequestMapping("/admin/friend/patient_event")
@RestController
public class AdminFriendPatientEventController {

	Logger logger = LoggerFactory.getLogger(AdminFriendPatientEventController.class);
	@Autowired
	FriendPatientEventService patientEventService;

	@Autowired
	FriendTreatmentService treatmentService;

	@Autowired
	FriendPatientEventDayService patientEventDayService;
	/**
	 *就诊记录列表
	 */
	@ArgIndexForPrintLog(indexes={0})
	@RequestMapping(value = "/treatment/list/{friendId}", method = RequestMethod.GET)
	public ResultList<FriendTreatmentRes> findMyEasemodAccount(@PathVariable("friendId") Integer friendId,Integer startId,Integer endId,Integer start,Integer limit,Principal principal){
		FriendTreatmentQuery query = new FriendTreatmentQuery();
		query.setStartId(startId);
		query.setStart(start);
		query.setEndId(endId);
		query.setLimit(limit);
		query.setFriendId(friendId);
		List<FriendTreatmentRes> res = treatmentService.findFriendTreatmentByQuery(query);

		return new ResultList<FriendTreatmentRes>(res);
	}

	

	/**
	 *血压周期表
	 */
	@ArgIndexForPrintLog(indexes={0})
	@RequestMapping(value = "/week_blood_press/{friendId}", method = RequestMethod.GET)
	public ResultList<FriendPatientEventDay> findWeekBloodPress(Principal principal,@PathVariable("friendId") Integer friendId){
		List<FriendPatientEventDay> list = patientEventDayService.findWeekBloodPress(friendId);
		return new ResultList<>(list);
	}



}
